<?php



$FamilyId = @$_GET['FamilyId'];
$IndividualId = @$_GET['IndividualId'];

if(!is_null($FamilyId) or $FamilyId===0) {
		$sql = 'SELECT FamilyPhoto as PHOTO, FamilyPhotoName as PHOTONAME, FamilyPhotoSize as PHOTOSIZE, FamilyPhotoType as PHOTOTYPE from '.$PACTS_cfg->familytablename.' WHERE FamilyId='.$FamilyId;
}else
{
	if(!is_null($IndividualId) or $IndividualId===0) {
		$sql = 'SELECT IndividualPhoto as PHOTO, IndividualPhotoName as PHOTONAME, IndividualPhotoSize as PHOTOSIZE, IndividualPhotoType as PHOTOTYPE from '.$PACTS_cfg->individualtablename.' WHERE IndividualId='.$IndividualId;
	} else{
	exit;
	}
}

//$sql = "SELECT IndividualPhoto as PHOTO from Individual WHERE IndividualId=0;";

//echo $sql;
$result = mysql_query($sql, $PACTS_cfg->dblink);
//$row = mysql_fetch_array($result)  ;

//$result=@mysql_query($query);

	while($d = mysql_fetch_array($result)){
         $data = $d["PHOTO"];
         $type = $d["PHOTOTYPE"];
    }
    Header(  "Content-type: $type");
    echo $data;
    exit;
?>